// 存储所有的路由页面
import React from 'react'

import { Switch, Route } from 'react-router-dom'
import Home from './core/Home'
import Shop from './core/Shop'
import Cart from './core/Cart'
import Login from './core/Login'
import Register from './core/Register'
import AdminDashboard from './admin/AdminDashboard'
// 创建的受保护的组件(只有在登录以后才能访问该组件下创建的组件)
import AdminPrivate from './admin/AdminPrivate'
import UserDashboard from './core/UserDashboard'
import UserPrivate from './core/UserPrivate'
import AddCategory from './admin/AddCategory'
import AddProduct from './admin/AddProduct'
import ProductDetail from './core/ProductDetail'
import Order from './admin/Order'


function Routes() {
	return (
		<Switch>
			<Route path="/" component={Home} exact></Route>
			<Route path="/shop" component={Shop}></Route>
			<Route path="/cart" component={Cart}></Route>
			<Route path="/login" component={Login}></Route>
			<Route path="/register" component={Register}></Route>
			<AdminPrivate path="/admin/dashboard" component={AdminDashboard}></AdminPrivate>
			<UserPrivate path="/user/dashboard" component={UserDashboard}></UserPrivate>
			<AdminPrivate path="/create/category" component={AddCategory}></AdminPrivate>
			<AdminPrivate path="/create/product" component={AddProduct}></AdminPrivate>
			<AdminPrivate path="/order/list" component={Order}></AdminPrivate>
			<Route path="/product/:productId" component={ProductDetail}></Route>
		</Switch>
	)
}

export default Routes
